package com.myPlaneGame.obj;

import com.myPlaneGame.GameCreate;
import com.myPlaneGame.Utils.GameUtils;

import java.awt.*;

public class BossBullet extends GameObj{
    public BossBullet() {
        super();
    }

    public BossBullet(Image img, int width, int height, int x, int y, double speed, GameCreate frame) {
        super(img, width, height, x, y, speed, frame);
    }

    public BossBullet(Image img, int x, int y, double speed) {
        super(img, x, y, speed);
    }

    public BossBullet(int x, int y) {
        super(x, y);
    }

    @Override
    public void paintSelf(Graphics g) {
        super.paintSelf(g);
        y+=speed;
        //技能清除子弹
        if(PlaneObj.skillUsing==1){
            this.x=-1000;
            this.y=-1000;
        }
        //技能开启保护网
        if(PlaneObj.skillUsing==2){
            if (this.y>450&&this.y<800) {
                this.x=-1000;
                this.y=-1000;
                GameUtils.removeList.add(this);
            }
        }

        //越界判断：清除跃出游戏窗口的数据（降低游戏页面绘制的压力）
        if(this.y>800){
            GameUtils.removeList.add(this);
        }
        //重新刷新游戏数据
        if(GameCreate.state==3||GameCreate.state==4){
            this.x=-1000;
            this.y=-1000;
            GameUtils.removeList.add(this);
        }
    }

    @Override
    public Rectangle getRec() {
        return super.getRec();
    }
}
